package display.android.fyales.com.displaytime;

import java.util.HashMap;

/**
 * @author fyales
 * @since 2017/10/16
 */

public class ClockUtil {

    public static final String CLOCK_HOUR = "hour";
    public static final String CLOCK_MINUTE = "minute";
    public static final String CLOCK_SECOND = "second";

    private static HashMap<String,String> mTimeInfoMap;

    public static HashMap<String, String> setClockInfo(long mileSeconds){
        if (mTimeInfoMap == null){
            mTimeInfoMap = new HashMap<>();
        }
        long tempSeconds = mileSeconds / 1000;
        long hour = tempSeconds / 3600;
        long tempSecondsWithoutHour = tempSeconds % 3600;
        long minute = tempSecondsWithoutHour / 60;
        long second = tempSecondsWithoutHour % 60;
        mTimeInfoMap.put(CLOCK_HOUR,Long.toString(hour));
        mTimeInfoMap.put(CLOCK_MINUTE,Long.toString(minute));
        mTimeInfoMap.put(CLOCK_SECOND,Long.toString(second));
        return mTimeInfoMap;

    }
}
